#include<stdio.h>
#include<iostream>
#include<string.h>
#include<math.h>
using namespace std;
int main()
{
	char hd1[1000], hd2[1000];
	int diff;
	while (cin >> hd1)
	{
		if (hd1[0] == 'X')break;
		diff = 0;
		cin >> hd2;
		for (int i = 0; i < strlen(hd1); i++)
		{
			if (hd1[i] != hd2[i])diff++;
		}
		printf("Hamming distance is %d.\n", diff);
	}
	return 0;
}